<template>
  <div>
    <el-dialog title="设备配置" :visible.sync="dialogFormVisible" v-if="dialogFormVisible" width="80%">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="基础配置" name="base">
          <base-device-edit ref="baseConfig" :deviceCode="devInfo.deviceCode"></base-device-edit>
        </el-tab-pane>
        <el-tab-pane label="网络配置" name="net">
          <net-edit ref="netConfig" :deviceCode="devInfo.deviceCode"></net-edit>
        </el-tab-pane>
        <el-tab-pane label="端口1" name="port1">
          <port-edit ref="portConfig" :deviceCode="devInfo.deviceCode" :port="0"></port-edit>
        </el-tab-pane>
        <el-tab-pane label="端口2" name="port2">
          <port-edit ref="portConfig" :deviceCode="devInfo.deviceCode" :port="1"></port-edit>
        </el-tab-pane>
      </el-tabs>
    </el-dialog>
  </div>
</template>

<script>
import qs from "qs";
import BaseDeviceEdit from "./base-device-edit";
import PortEdit from "./port-edit";
import NetEdit from "./net-edit";
export default {
  name: "DeviceEdit",
  data() {
    return {
      dialogFormVisible: false,
      activeName: "base",
      devInfo: {},
    };
  },
  components: {
    BaseDeviceEdit,
    PortEdit,
    NetEdit
  },
  computed: {},
  created() {},
  mounted() {
    // this.activePanel=this.$refs.baseConfig;
    // this.activePanel=this.$refs.portConfig;
  },
  methods: {
    show(devInfo) {
      this.devInfo = devInfo;
      this.dialogFormVisible = true;
    },
    hide() {
      this.dialogFormVisible = false;
    },
    resetTab(name){
      this.activeName = name;
    },
    // updateDeviceConfig(){
    //   switch(this.activeName){
    //     case 'base':
    //       this.$refs.baseConfig.updateDeviceConfig();
    //   }
    // },
    handleClick(tab, event) {

    },
  },
};
</script>
<style>
.device-list-charts {
  text-align: left;
  margin-top: 20px;
}
.device-list-pagination {
  margin-top: 30px;
}
</style>
